 //首页轮播图
    let CarouselMapLeft = document.getElementsByClassName("CarouselMapLeft")[0]
    //获取右边小图的所有元素
    let CarouselMapImg = document.getElementsByClassName("CarouselMapImg");
    let time;
    let index = 0;
    //设置一个重置函数
    function CarouselMapBox() {
        for (let i = 0; i < CarouselMapImg.length; i++) {
            CarouselMapImg[i].className = "CarouselMapImg"
        }
    }
    //设置一个选中函数
    let CarouselMapBoxTow = function () {
        CarouselMapBox();
        CarouselMapImg[index].className = "CarouselMapImg image";
    }
    CarouselMapLeft.style.backgroundImage = "url(../static_resources/img/1.jpg)";
    //设置启动轮播图的时间函数
    function turnOn() {
        time = setInterval(function () {
            CarouselMapBoxTow();
            index++;
            CarouselMapLeft.style.backgroundImage = "url(../static_resources/img/" + index + ".jpg)";
            if (index == 5) {
                index = 0;
            }
        }, 1500);
    }
    for (let i = 0; i < CarouselMapImg.length; i++) {
        //鼠标移动到当前小图片时触发
        CarouselMapImg[i].onmousemove = function () {
            //鼠标移动到当前小图片时左边变为当前小图片
            CarouselMapLeft.style.backgroundImage = "url(../static_resources/img/" + (i + 1) + ".jpg)";
            //鼠标移动到小图片上面时关闭定时器并重置定时，鼠标移开后再继续执行
            CarouselMapBox();
            clearInterval(time);
            index = i + 1;
            turnOn();
        }
    }
    //执行轮播图
    turnOn()

    //返回顶部
    let backToTop=document.getElementsByClassName("backToTop")[0];
    //onscroll()事件:div元素滚动时执行js
    document.addEventListener("scroll",function(){
        //获取当前页面滚动条纵坐标位置
        let distanceFromTop=document.documentElement.scrollTop;
        if(distanceFromTop>=300){
            backToTop.style.display="block";
        }else{
            backToTop.style.display="none";
        }
        //true表示传播方式为事件捕获传播(先分析外层再分析内层)，默认值为false(事件冒泡传播)(先分析内层再分析外层)
    },true);
    //俺一定速度返回顶部
    // backToTop.onclick=function()
    function backToTopFn(){
        var backTop=setInterval(function(){
            var topDistance=document.documentElement.scrollTop||document.body.scrollTop;
            if(topDistance>0){
                document.documentElement.scrollTop=document.body.scroll=topDistance-20;
            }else{
                clearInterval(backTop);
            }
        })
    }
    backToTop.addEventListener('click',function(){
        backToTopFn();
    })
    //上下浮动
    setInterval(function(){
        upAndDownFn()
    },600);

    function upAndDownFn(){
        backToTop.style.bottom="80px";
        setTimeout(function (){
            backToTop.style.bottom="50px";
        },300)
    }
    //点击回到对应位置
    var homeRightNav=document.getElementsByClassName("homeRightNav")[0];
    var allLi=homeRightNav.getElementsByTagName("li");
    allLi[0].onclick=function (){
        returnPosition("0");
        returnPositionX("0");
    }
    allLi[1].onclick=function(){
        returnPosition("25");
        returnPositionX("25")
    }
    allLi[2].onclick=function(){
        returnPosition('305');
        returnPositionX('305')
    }
    allLi[3].onclick=function(){
        returnPosition('630');
        returnPositionX('630')
    }
    allLi[4].onclick=function(){
        returnPosition('1010')
        returnPositionX('1010')
    }
    function returnPosition(e){
        let backTop=setInterval(function(){
            let topDistance=document.documentElement.scrollTop||document.body.scrollTop;
            if(topDistance>e){
                document.documentElement.scrollTop=document.body.scrollTop=topDistance-20;
            }else{
                clearInterval(backTop);
            }
        },10)
    }
    function returnPositionX(e){
        let backTop=setInterval(function(){
            let topDistance=document.documentElement.scrollTop||document.body.scrollTop;
            if(topDistance<e){
                document.documentElement.scrollTop=document.body.scrollTop=topDistance+20;
            }else{
                clearInterval(backTop);
            }
        },10)
    }
    function backgroundColor(e){
        for(let i=0;i<allLi.length;i++){
            allLi[i].style.backgroundColor="";
            allLi[i].style.color="black";
        }
        allLi[e].style.backgroundColor="#00c4ff";
        allLi[e].style.color="#ffffff";
    }
    allLi[0].style.backgroundColor="#00c4ff";
    allLi[0].style.color="#ffffff";
    document.onscroll=function(){
        let distanceFromTop=document.documentElement.scrollTop||document.body.scrollTop;
        if(distanceFromTop>=0&&distanceFromTop<=5){
            backgroundColor('0')
        }
        if(distanceFromTop>5&&distanceFromTop<=280){
            backgroundColor('1')
        }
        if(distanceFromTop>280&&distanceFromTop<=610){
            backgroundColor('2')
        }
        if(distanceFromTop>610&&distanceFromTop<=990){
            backgroundColor('3')
        }
        if(distanceFromTop>990){
            backgroundColor('4')
        }
    }

    var DispClose = true;
    function CloseEvent()
    {
        if (DispClose)
        {
            // return "是否离开当前页面?";
            localStorage.clear();    //清除所有的本地缓存
        }
    }
    function UnLoadEvent()
    {
        DispClose = false;
    }
    let source=document.getElementsByClassName("source");
    let videoWindowContent=document.getElementsByClassName("videoWindowContent")[0];
    let deleteS=document.getElementsByClassName("deleteS")[0];
    let BigVideo=document.getElementsByClassName("BigVideo")[0];
    let sourceVideo=document.getElementsByClassName("sourceVideo");
    for(let i=0;i<source.length;i++){
        source[i].onclick=function(){
            videoWindowContent.style.display="block";
            BigVideo.src=sourceVideo[i].src;
        }
    }
    deleteS.addEventListener('click',function(){
        videoWindowContent.style.display="none";
    },true);
    let checkMore=document.getElementsByClassName("checkMore");
    checkMore[2].style.display="none";

